Most electrical or electronic device enclosures including photoelectric sensor enclosures are provided with holes for attaching to a mounting bracket. The mounting bracket is generally an L-shaped bracket designed for mounting the device to a flat surface. These L-shaped brackets generally include holes on one leg for attaching to the device enclosure and holes on the other leg for attaching to the mounting surface. Devices which have provisions for mounting on DIN rails have had these provisions incorporated as an integral part of the device enclosure. Mounting on a DIN rail requires locking mechanism and a release mechanism which generally includes a movable or flexible part which can be released from the mounting rail. Rymer U.S. Pat. No. 3,992,074 discloses a flexible latching member formed as an integral part of the device while the Idec Corporation model FFR 1H OPTO FIBER SENSOR incorporates a sliding latch retained by a spring which permits it to engage and disengage the DIN mounting rail. By incorporating the DIN mounting rail provisions as a part of the device enclosure the manufacturing cost of the device is increased. In many instances manufacturing time is also increased since some assembly may be required to install the release mechanism parts to the device enclosure.